package epoch.game.core.common;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormat {
	
	private static String default_format_str = "yyyy-MM-dd HH:mm:ss";
	private static ThreadLocal<SimpleDateFormat> dateFormater = new ThreadLocal<>();
	
	public static String formatTime(long time) {
		return getDefaultFormat().format(new Date(time));
	}
	
	public static SimpleDateFormat getDefaultFormat(){
		SimpleDateFormat format = dateFormater.get();
		if(format==null){
			format = new SimpleDateFormat(default_format_str);
			dateFormater.set(format);
		}
		return format;
	}
}